Method, apparatus, and computer program product for improved graphics   performance

ABSTRACT

A method for improving performance of generation of digitally represented graphics. The method comprises: receiving a first representation of a base primitive; providing a set of instructions associated with vertex position determination; executing said retrieved set of instructions on said first representation of said base primitive using bounded arithmetic for providing a second representation of said base primitive, and subjecting said second representation of said base primitive to a culling process. A corresponding apparatus and computer program product are also presented.

FIELD OF THE INVENTION

The present invention relates to digitally represented graphics and moreparticularly to a method, an apparatus and a computer program productfor improving the performance of generating digitally representedgraphics.

BACKGROUND OF THE INVENTION

Digitally represented graphics, such as computer graphics, iscontinuously improving in performance. In the 1980's and 1990's, displayadapters for computers and game consoles appeared with graphicsaccelerators, offloading the Central Processing Unit (CPU) in graphicsgeneration. Initially, the display adapters offered acceleration of 2Dgraphics, but eventually these also included support for accelerated 3Dgraphics. Modern display adapters use a processing unit often named agraphics processing unit (GPU).

Due to the complexity of 3D graphics, GPU:s of today use a significantamount of their processing power to perform calculations related to 3Dgraphics.

A continuous problem with display adapters is performance. There arealways new applications and games requiring higher frame rates (renderedscreen images per second), higher resolutions and higher image quality,resulting in requirements that each screen image should be rendered in ashort a time as possible. In other words, it is always important toincrease performance.

One way known to increase performance is to increase the processingpower of the GPU:s by enabling higher clock speeds, pipelining, orexploiting parallel computations. However, this often generates moreheat, resulting in more power consumption and higher fan noise forcooling the GPU. Power consumption and heat is a major constraint andbottleneck for mobile devices. Moreover, there are limits to the clockspeeds of each GPU.

Consequently, there is still a problem with insufficient abilities toimprove performance in digitally represented graphics.

SUMMARY OF THE INVENTION

In view of the above, an objective of the invention is to solve or atleast reduce the problems discussed above.

Generally, the above objectives are achieved by the attached independentpatent claims.

According to a first aspect, the present invention is realized by amethod for improving performance of generation of digitally representedgraphics. The method comprises: receiving a first representation of abase primitive; providing a set of instructions associated with vertexposition determination; executing said set of instructions on said firstrepresentation of said base primitive using bounded arithmetic forproviding a second representation of said base primitive; and subjectingsaid second representation of said base primitive to a culling process.Performing culling on base primitives is advantageous in that baseprimitives, and representations of base primitives, may be discarded atthe beginning of the graphics pipeline, which results in performancegains. Furthermore, a majority of surfaces being invisible in the fullyrendered image are not forwarded in the process, which also results inperformance gains. In other words, performing culling on entire baseprimitives is advantageous in that tessellation of the majority ofinvisible surfaces is avoided, which results in performance gains.

In computer graphics, a vertex comprises data associated with a locationin space. For example, a vertex may be all data associated with a cornerof a primitive. The vertices are associated not only with three spatialcoordinates but also with other graphical information necessary torender objects correctly, such as colours, reflectance properties,textures, and surface normals.

A connected set of vertices can be used to define a primitive. Aprimitive may for example be a triangle, quadrilateral, polygon, orother geometric form or, alternatively, a primitive may for example be asurface or a point in space. A primitive that is represented as atriangle has for example three vertices and a quadrilateral has fourvertices.

The method may comprise selecting at least one vertex from said firstrepresentation of said base primitive, executing a set of instructionsassociated with vertex position determination on a first representationof said at least one vertex for providing a second representation ofsaid at least one vertex, and subjecting said second representation ofsaid at least one vertex to a culling process, wherein an outcome ofsaid culling process comprises one of a decision to cull said at leastone vertex, and a decision not to cull said at least one vertex, and incase the outcome of said culling process comprises a decision to cullsaid at least one vertex, perform: said receiving a first representationof a base primitive, said providing a set of instructions associatedwith vertex position determination, said executing said set ofinstructions on said first representation of said base primitive usingbounded arithmetic for providing a second representation of said baseprimitive, and said subjecting said second representation of said baseprimitive to a culling process. This is advantageous since it results inperformance gains. If for example the outcome of the culling process isa decision not to cull said at least one vertex, it yields a methodwhich is less capacity expensive as compared to the method according tothe first aspect.

The method may comprise determining a bounding volume enclosing saidsecond representation of said base primitive; and subjecting saidbounding volume to a culling process. This is advantageous in that nopredetermined bounds have to be provided and the bounding volume isdetermined automatically.

The method may comprise executing a tessellation process, wherein saidtessellation process is based on an outcome of said culling process.Hence, culling is performed before tessellation. Performing thetessellation after the culling results in performance gains since fewerbase primitives are tessellated and is thus advantageous. Said cullingprocess could be the culling process that the second representation issubjected to and/or the culling process that the bounding volume issubjected to.

The method may comprise that said culling process is replaceable. Thisis advantageous in that the culling process may be amended by forexample a user. The culling process being replaceable applies to allembodiments of the first aspect.

The method may comprise that the bounded arithmetic is at least one fromthe group of Taylor arithmetic, interval arithmetic, and affinearithmetic. This is advantageous in that the method is flexible andsupports different types of bounded arithmetic and is not restricted toone type of bounded arithmetic. Itis preferred to use Taylor modelssince curved surfaces and subdivision schemes, which are often used intessellation, are often based on polynomials. Another advantage is thatpolynomial computations can be represented exactly by Taylor models(provided that they are of high enough order) which leads to very tightbounds.

The method may comprise that the determining of said bounding volumefurther comprises computing a minimum and a maximum of said secondrepresentation. This is advantageous in that it is aperformance-efficient way to determine the bounding volume.

The method may comprise that said second representation is at least onefrom the group of a positional bound, and a normal bound. The positionaland normal bound may be used for determining for example the position orrange of the first representation of the base primitive. A furtheradvantage is that the positional and normal bound are determinedautomatically.

The method may comprise that executing said set of instructions furthercomprises: deriving a second set of instructions from said set ofinstructions associated with vertex position determination, andexecuting said second set of instructions for providing a normal bound.This is advantageous in that the second set of instructions is derivedautomatically and, furthermore, the normal bound is computedautomatically.

The method may comprise that subjecting said bounding volume to saidculling process further comprises performing at least one of subjectingsaid bounding volume to view frustum culling, subjecting said boundingvolume to back-face culling, and subjecting said bounding volume toocclusion culling. An advantage with this is that many different cullingtechniques are applicable.

The method may comprise that subjecting said second representation(being a positional or normal bound) to said culling process furthercomprises performing at least one of subjecting said positional bound toview frustum culling, subjecting said positional bound or said normalbound to back-face culling, and subjecting said positional bound toocclusion culling. An advantage with this is that many different cullingtechniques are applicable.

The method may comprise that an outcome of said culling processcomprises one of a decision to discard said base primitive, and atessellation factor. This is advantageous since discarding a baseprimitive implies a base primitive less to render which increasesperformance. The tessellation factor may indicate that the baseprimitive is not to be tessellated which results in performance gain.

The method may comprise executing a tessellation process, in case theoutcome of said culling process comprises a tessellation factor. This isadvantageous in that performance is gained for every base primitive thatis not tessellated or less tessellated. If the outcome of said cullingprocess is a decision to discard said base primitive, no tessellationprocess is executed.

According to a second aspect, the present invention is realized by anapparatus adapted to generate digitally represented graphics comprisingcircuitry for improving performance of generation of digitallyrepresented graphics. Said circuitry is adapted to: receive a firstrepresentation of a base primitive; provide a set of instructionsassociated with vertex position determination; execute said set ofinstructions on said first representation of said base primitive usingbounded arithmetic for providing a second representation of said baseprimitive; and subject said second representation of said base primitiveto a culling process.

It is to be noted that the second aspect of the invention can beembodied with any combination of features corresponding to any of thefeatures of the first aspect of the invention.

The advantages of the first aspect are equally applicable to the secondaspect.

According to a third aspect, the present invention is realized by acomputer program product, comprising computer program code which isstored on a computer-readable storage medium and which, when executed ona processor, performs the method according to the first aspect of theinvention. The advantages of the first aspect are equally applicable tothe third aspect of the invention.

Other objectives, features and advantages of the present invention willappear from the following detailed disclosure, from the attached claimsas well as from the drawings.

Generally, all terms used in the claims are to be interpreted accordingto their ordinary meaning in the technical field, unless explicitlydefined otherwise herein. All references to “a/an/the [element, device,component, means, step, etc]” are to be interpreted openly as referringto at least one instance of said element, device, component, means,step, etc., unless explicitly stated otherwise. The steps of any methoddisclosed herein do not have to be performed in the exact orderdisclosed, unless explicitly stated.

BRIEF DESCRIPTION OF THE DRAWINGS

Other features and advantages of the present invention will becomeapparent from the following detailed description of a presentlypreferred embodiment, with reference to the accompanying drawings, inwhich

FIG. 1 is a block diagram illustrating how different entities, in adisplay adapter according to prior art, interact.

FIG. 2a is a block diagram illustrating how different entities in anapparatus may interact in an embodiment of the present invention.

FIG. 2b is a block diagram illustrating an embodiment of the presentinvention.

FIG. 2c is a block diagram illustrating an embodiment of the presentinvention.

FIG. 2d is a block diagram illustrating an embodiment of the presentinvention.

FIG. 2e is a block diagram illustrating an embodiment of the presentinvention.

FIG. 2f is a block diagram illustrating an embodiment of the presentinvention.

FIG. 2g is a block diagram illustrating an embodiment of the presentinvention.

FIG. 2h is a block diagram illustrating an embodiment of the presentinvention.

FIGS. 3a and 3b are flowcharts showing base primitive culling processesthat can be executed in the apparatus of FIGS. 2a -d.

FIG. 4 schematically illustrates the base primitive culling processes ofFIGS. 3a -b.

FIG. 5 shows an overview architecture of a typical general purposecomputer embodying the apparatus of FIGS. 2a -d.

DETAILED DESCRIPTION

The present invention will now be described more fully hereinafter withreference to the accompanying drawings, in which certain embodiments ofthe invention are shown. This invention may, however, be embodied inmany different forms and should not be construed as limited to theembodiments set forth herein; rather, these embodiments are provided byway of example so that this disclosure will be thorough and complete,and will fully convey the scope of the invention to those skilled in theart. Like numbers refer to like elements throughout.

FIG. 1 is a block diagram illustrating how different entities, in aconventional display adapter known to a person skilled in the art,interact. A display adapter according to prior art may comprise atessellator 120, a vertex shader 130, a triangle traversal unit 140, anda fragment shader 150. The entities of the display adapter according toprior art are well known to the person skilled in the art.

The input 110 to the tessellator 120 is base primitive, which may be atriangle, quadrilateral, or other geometric form. Tessellation impliesthat many smaller, often connected primitives are created. For example,a base triangle (i.e., the base primitive) is in the tessellator 120tessellated into 100×100 smaller, connected triangles covering the basetriangle. The position of the vertices of these smaller triangles canthen be computed in the vertex shader unit 130, so that a curved surfaceis formed.

Different types of tessellation exist, for example uniform tessellation,fractional tessellation, and adaptive tessellation.

The vertex shader unit 130 receives barycentric coordinates for everyvertex from the tessellator 120 and computes for example the position,p(u,v), of the vertex as a function of the barycentric coordinates(u,v).

The triangle traversal unit 140 is responsible for setting up polygonsas instructed by a connected controller. Although any polygon can beused, triangles are commonly used. For each polygon, the triangletraversal unit 140 divides the polygon to be rendered into one or moretiles, where each tile is at least partly overlapped by the polygon. Ingeneral, a tile is a group of fragments. A tile is a two-dimensionalrectangle containing a number of fragments. Each of these fragmentscorrespond to a pixel and contain all data required to render the pixeland to test whether the pixel should be rendered on the screen. A commonsize of a tile is 8 by 8 fragments, although any tile size is within thescope of the invention.

Another important task of the triangle traversal unit 140 is to find thefragments that are inside the geometric primitive (e.g., triangle) beingrendered. This can be done using a variety of techniques, the techniquesbeing known to a person skilled in the art.

The fragment shader 150 executes a fragment shader program for eachfragment passed to this unit. Each of these fragments correspond to apixel and contain data required to render the pixel and to test whetherthe pixel should be rendered on the screen. The fragment data includesraster position, depth, colour, texture coordinates, stencil, alpha(used for blending), etc. For every pixel there may exist a plurality offragment samples.

The fragments are further processed in order to for example combinepreviously evaluated colour with textures, as well as to add effectssuch as fog, as well as to, when possible, identify fragments that donot need to be rendered, i.e. fragment culling.

The fragment shader 150 may further perform depth testing, alphatesting, and blending before the fragments are written to targetbuffers.

The output 150 from the display adapter according to prior art may bedisplayed on a display.

It is to be noted that from here on, the present invention will bedescribed.

Different embodiments of an apparatus adapted to generate digitallyrepresented graphics according to the invention will be described belowwith reference to FIG. 2. The apparatus comprises circuitry forimproving performance of generation of digitally represented graphics.Said apparatus may be embodied as a display adapter and will hereinafterbe referred to as a display adapter.

FIG. 2a is a block diagram illustrating an embodiment of a displayadapter 205 according to the present invention. The display adapter 205comprises circuitry for improving performance of generation of digitallyrepresented graphics, forming a base primitive culling unit 212.

The input 210 to the base primitive culling unit 212 is firstrepresentation of a base primitive. A geometric primitive in the fieldof computer graphics is usually interpreted as atomic geometric objectsthat the system can handle, for example draw or store. All othergraphics elements are built up from these primitives.

The base primitive is a suitable geometrical representation which can betessellated into many smaller geometric primitives, such as triangles. Abase primitive is non-tessellated. Examples of base primitives aretriangles, quadrilaterals, lines, curves, Bezier surfaces, etc.

Polygons are defined using a connected set of vertices. A triangle hasfor example three vertices and a quadrilateral has four vertices. Incomputer graphics, the vertices are associated not only with threespatial coordinates but also with other graphical information necessaryto render the object correctly, such as colours, reflectance properties,textures, and surface normals.

A first representation of a base primitive may be a set of attributes.The set of attributes may for example be one from the group of controlpoint, vertex position, normal, texture coordinate, etc. For example, atriangle can be described using three vertex positions, and aquadrilateral polygon using four vertex positions as well. Each vertexposition may also be associated with other attributes, such as normalsand texture coordinates. Another example is a Bezier triangle or patch,which can be described using a set of vertex positions and controlpoints.

In the base primitive culling unit 212, culling is performed on baseprimitives and on representations of base primitives. The output 222from the base culling unit may be that the base primitive is to bediscarded. In another embodiment, an output 222 may be that atessellation factor is created. This tessellation factor may be set to avalue indicating that the base primitive is to be discarded.Alternatively, the tessellation factor may be set to a value indicatingthat the base primitive could not be discarded. Furthermore, thetessellation factor may be set to a value indicating that the baseprimitive is not to be tessellated, is to be tessellated coarsely, or isto be tessellated at a low rate.

The details and effects of the base primitive culling are furtherdescribed in conjunction with FIG. 3a and FIG. 3 b, below.

The output 224 from the display adapter 205 may be displayed on adisplay.

In another embodiment, see FIG. 2 b, the display adapter 205 comprises abase primitive culling unit 212 and a tessellator 214. The tessellator214 may be of similar type as the tessellator 120 described above withreference to FIG. 1.

The base primitive culling unit 212, the input 210 to the base primitiveculling unit 212 and the output 224 from the display adapter 205 havebeen previously described in connection with FIG. 2 a.

If the tessellator 214 receives, from the base primitive culling unit212, a base primitive and a tessellation factor indicating that the baseprimitive is not to be tessellated, the tessellator does not tessellatethe base primitive.

If the tessellator 214 receives, from the base primitive culling unit212, a base primitive but does not receive a tessellation factorindicating that the base primitive is not to be tessellated, thetessellator 214 tessellates the base primitive.

FIG. 2c is a block diagram illustrating how different entities in adisplay adapter 205 may interact in an embodiment of the presentinvention. The display adapter 205 comprises a base primitive cullingunit 212, a tessellator 214, a vertex shader 216, a triangle traversalunit 218, and a fragment shader 220. The entities 214, 216, 218, and 220may be of similar type as those described above with reference to FIG.1.

The base primitive culling unit 212, the input 210 to the base primitiveculling unit 212 and the output 224 from the display adapter 205 havebeen previously described in connection with FIG. 2 a.

In yet another embodiment, see FIG. 2 d, the display adapter 205comprises a base primitive culling unit 212, a tessellator 214, a vertexshader 216, a triangle traversal unit 218, a programmable culling unit(PCU) 226, and a fragment shader 220. The entities 214, 216, 218, and220 may be of the same or similar type as those described above withreference to FIG. 1. The base primitive culling unit 212, the input 210to the base primitive culling unit 212 and the output 224 from thedisplay adapter 205 have been previously described in connection withFIG. 2 a.

In the programmable culling unit 226, culling is performed on tilesaccording to a replaceable culling program, also known as a replaceableculling module. The details of this culling program and the effects areexplained in more detail in the non-published Swedish patent applicationSE0700162-1, the content of which is hereby incorporated by reference.

The display adapter 205 of FIG. 2a may further comprise a base primitiveprobing unit 211, see FIG. 2 e. The base primitive probing unit 211 isarranged to check if at least one vertex of a base primitive can beculled. At least one vertex from the base primitive is selected. The atleast one vertex can for example be the vertices of the base primitiveor the centre of the base primitive. If the at least one vertex of thebase primitive cannot be culled it implies that the base primitivecannot be culled and then it is better not to perform the base primitiveculling in the base primitive culling unit 212 since base primitiveculling is capacity demanding.

As is shown in FIG. 2f the display adapter 205 of FIG. 2b may furthercomprise a base primitive probing unit 211. Furthermore, the displayadapter 205 of FIG. 2c may comprise a base primitive probing unit 211,see FIG. 2 g. The display adapter 205 of FIG. 2d may comprise a baseprimitive probing unit, see FIG. 2 h.

FIG. 3a shows a flow chart for a base primitive culling program that canbe executed in the base primitive culling unit 212 of FIGS. 2 a, b, c,and d.

In step 310, a first representation of a base primitive is received.

In step 320, a set of instructions is provided. The provided set ofinstructions is associated with vertex position determination. Vertexpositions are for example computed using barycentric coordinates forevery vertex as p(u,v), as described in connection with the vertexshader unit 216. The set of instructions is derived or retrieved from avertex shader program which can be executed in the vertex shader unit216. The set of instructions is then analysed and all instructions thatare used to compute the vertex position, the arithmetic instructions,are isolated. The instructions are redefined into operating on boundedarithmetic, for example Taylor arith-metic, interval arithmetic, affinearithmetic, or another suit-able arithmetic known to a person skilled inthe art. In one embodiment, the instructions are redefined intooperating on Taylor models (instead of floating point numbers) and theinput to the new instructions is redefined into being Taylor models.

A brief description of Taylor models follows in order to facilitate theunderstanding of the following steps.

Intervals are used in Taylor models, and the following notation is usedfor an interval:

â=[a,ā]={x|a≤x≤ā}  equation (1)

Given an n+1 times differentiable function, ƒ(u), where u∈[u₀,u₁], theTaylor model of ƒ is composed of a Taylor polynomial, T_(ƒ), and aninterval remainder term, {circumflex over (r)}_(ƒ). An nth order Taylormodel, here denoted {tilde over (ƒ)}, over the domain u∈[u₀,u₁] is then:

$\begin{matrix}{{{{{\overset{\sim}{f}(u)} \in {{\sum\limits_{k = 0}^{n}{\frac{f^{(k)}\left( u_{0} \right)}{k!} \cdot \left( {u - u_{0}} \right)^{k}}} + \left\lbrack {\underset{\_}{r_{f}},\overset{\_}{r_{f}}} \right\rbrack}} = {{\sum\limits_{k = 0}^{n}{c_{k}u^{k}}} + {\hat{r}}_{f}}},\mspace{20mu} {wherein}}\mspace{20mu} {\sum\limits_{k = 0}^{n}{\frac{f^{(k)}\left( u_{0} \right)}{k!} \cdot \left( {u - u_{0}} \right)^{k}}}} & {{equation}\mspace{14mu} (2)}\end{matrix}$

is the Taylor polynomial and └r_(ƒ) ,r_(ƒ) ┘ is the interval remainderterm. This representation is called a Taylor model, and is aconservative enclosure of the function ƒ over the domain u∈[u₀,u₁]. Itis also possible to define arithmetic operators on Taylor models, wherethe result is a conservative enclosure as well (another Taylor model).As a simple example, assume that f+g is to be computed, and that thesefunctions are represented as Taylor models, {tilde over(ƒ)}=(T_(ƒ),{tilde over (r)}_(ƒ)) and {tilde over (g)}=(T_(g),{tildeover (r)}_(g)). The Taylor model of the sum is then(T_(ƒ)+T_(g),{circumflex over (r)}_(ƒ)+{circumflex over (r)}_(g)). Morecomplex operators like multiplication, sine, log, exp, reciprocal, etc.,can also be derived. Implementation details for these operators aredescribed in BERZ, M., AND HOFFSTÄTTER, G. 1998, Computation andApplication of Taylor Polynomials with Interval Remainder Bounds,Reliable Computing, 4, 1, 83-97.

The barycentric coordinates may be redefined as a Taylor model, asfollows: bãry(u,v)=(u,v,1−u−v).

In step 330, the provided set of instructions is executed on the firstrepresentation of the base primitive using bounded arithmetic. Anoutcome of this executing of said set of instructions is a secondrepresentation of the base primitive.

Said second representation of the base primitive may be a Taylor modeland may be a polynomial approximation of the vertex position attribute.More specifically, the output from step 330 may be positional bounds:{tilde over (p)}(u,v)=({tilde over (p)}_(x),{tilde over (p)}_(y),{tildeover (p)}_(z),{tilde over (p)}_(w)) that is four Taylor models. For asingle component, for example x, this can be expressed in the powerbasis as follows (the remainder term, rf′ has been omitted for clarity):

$\begin{matrix}{{p\left( {u,v} \right)} = {\sum\limits_{{i + j} \leq n}^{\;}{a_{ij}u^{i}v^{j}}}} & {{equation}\mspace{14mu} (3)}\end{matrix}$

The bounded arithmetic used in step 330 may for example be Taylorarithmetic, interval arithmetic, affine arithmetic, or another suitablearithmetic known to a person skilled in the art.

In one embodiment, said second representation of said base primitive maybe normal bounds. For a parameterized surface, the unnormalized normal,n, can be computed as:

$\begin{matrix}{{n\left( {u,v} \right)} = {\frac{\partial{p\left( {u,v} \right)}}{\partial u} \times \frac{\partial{p\left( {u,v} \right)}}{\partial v}}} & {{equation}\mspace{14mu} (4)}\end{matrix}$

The normal bounds, that is the Taylor model of the normal, is thencomputed as

$\begin{matrix}{{\overset{\sim}{n}\left( {u,v} \right)} = {\frac{\partial{\overset{\sim}{p}\left( {u,v} \right)}}{\partial u} \times \frac{\partial{\overset{\sim}{p}\left( {u,v} \right)}}{\partial v}}} & {{equation}\mspace{14mu} (5)}\end{matrix}$

In one embodiment, step 330, executing said set of instructions maycomprise step 331, FIG. 3 b. Step 331 comprises deriving a second set ofinstructions from said set of instructions associated with vertexposition determination. The second set of instructions is retrieved froma vertex shader program executed in the vertex shader unit 216, theinstructions are analysed and all instructions that are used to computethe vertex position, the arithmetic instructions, are isolated. Theinstructions are redefined into operating on Taylor models (instead offloating point numbers) and the input to the new instructions isredefined into being Taylor models. The second set of instructions isthen executed for providing normal bounds.

A bounding volume for a set of objects is a closed volume thatcompletely contains the union of the objects in the set. Boundingvolumes may be of various shapes, for example boxes such as cuboids orrectangles, spheres, cylinders, polytopes, and convex hulls.

In one embodiment, a bounding volume enclosing said secondrepresentation of said base primitive is determined, step 350 FIG. 3 b,and the bounding volume is subject to a culling process. The cullingprocess is further described in connection with step 340.

The inventive bounding volume is a tight bounding volume. The boundingvolume being tight implies that the area or volume of the boundingvolume is as small as possible but still completely enclosing saidsecond representation of said base primitive.

In one embodiment, the bounding volume is deter-mined by computing aminimum and a maximum of said second representation, step 351.

The second representation of the base primitive may be Taylorpolynomials on power form.

One way of determining the bounding volume may be by computing thederivatives of the Taylor polynomials and thus finding the minimum andmaximum of the second representation.

Another way to determine the bounding volume may be according to thefollowing. The Taylor polynomials are converted into Bernstein form. Dueto the fact that the convex hull property of the Bernstein basisguarantees that the actual surface or curve of the polynomial liesinside the convex hull of the control points obtained in the Bernsteinbasis, the bounding volume is computed by finding the minimum andmaximum control point value in each dimension. Transforming equation 3into Bernstein basis gives:

$\begin{matrix}{{{p\left( {u,v} \right)} = {\sum\limits_{{i + j} \leq n}^{\;}{p_{ij}{B_{ij}^{n}\left( {u,v} \right)}}}}{where}{{B_{ij}^{n}\left( {u,v} \right)} = {\begin{pmatrix}n \\i\end{pmatrix}\begin{pmatrix}{n - i} \\j\end{pmatrix}u^{i}{v^{j}\left( {1 - u - v} \right)}^{n - i - j}}}} & {{equation}\mspace{14mu} (6)}\end{matrix}$

are the Bernstein polynomials in the bivariate case over a triangulardomain. This conversion is performed using the following formula, theformula being described in HUNGERBÜHLER, R., AND GARLOFF, J. 1998,Bounds for the Range of a Bivariate Polynomial over a Triangle. ReliableComputing, 4, 1, 3-13:

$\begin{matrix}{p_{ij} = {\sum\limits_{l = 0}^{i}{\sum\limits_{m = 0}^{j}{\frac{\begin{pmatrix}i \\l\end{pmatrix}\begin{pmatrix}j \\m\end{pmatrix}}{\begin{pmatrix}n \\l\end{pmatrix}\begin{pmatrix}{n - l} \\m\end{pmatrix}}a_{l\; m}}}}} & {{equation}\mspace{14mu} (7)}\end{matrix}$

To compute a bounding box, simply the minimum and the maximum value overall p_(ij), for each dimension, x, y, z, and w are computed. This givesa bounding box, {circumflex over (b)}=({circumflex over(b)}_(x),{circumflex over (b)}_(y),{circumflex over (b)}_(z),{circumflexover (b)}_(w)), in clip space, where each element is an interval, forexample {circumflex over (b)}_(x)=[b_(x) ,b_(x) ].

In step 340, said second representation of the base primitive is subjectto a culling process.

Culling is performed in order to avoid drawing objects, or parts ofobjects, that are not seen.

Prior art GPU:s, perform culling on tessellated polygons. The presentinvention performs culling before tessellation even occurs which resultsin performance gains.

In this approach, the positional bounds, normal bounds, and boundingvolume derived above are used for applying different culling techniqueson the base primitive.

In one embodiment, view frustum culling is per-formed using saidpositional bound or said bounding volume, step 341 FIG. 3 b.

In one embodiment, back-face culling is performed using at least onefrom the group of said normal bound, said positional bound, and saidbounding volume, step 342 FIG. 3 b.

In one embodiment, occlusion culling is performed using said positionalbound or said bounding volume, step 343 FIG. 3 b.

In one embodiment, at least one of the steps 341-343 is performed.

The culling techniques disclosed below are not be construed as limitingbut they are provided by way of example. It is obvious to a personskilled in the art that back-face culling, occlusion culling, and viewfrustum culling may be performed using various different techniques thanthe ones described below.

View frustum culling is a culling technique based on the fact that onlyobjects that will be visible, that is that are located inside thecurrent view frustum, are to be drawn. The view frustum may be definedas the region of space in the modelled world that may appear on thescreen. Drawing objects outside the frustum would be a waste of time andresources since they are not visible anyway. If an object is entirelyoutside the view frustum, it cannot be visible and can be discarded.

In one embodiment the positional bounds of the bounding volume aretested against the planes of the view frustum. Since the boundingvolume, b, is in homogeneous clip space, the test may be performed inclip space. A standard optimization for plane-box tests may be used,where only a single corner of the bounding volume, the bounding volumebeing a bounding box, is used to evaluate the plane equation. Each planetest then amounts to an addition and a comparison.

For example, testing if the volume is outside the left plane isperformed using: b_(x) +b_(w) <0. The testing may also be performedusing the positional bounds, {tilde over (p)}(u,v)=({tilde over(p)}_(x),{tilde over (p)}_(y),{tilde over (p)}_(z),{tilde over(p)}_(w)). Since these tests are time- and resource efficient, it isadvan-tageous to let the view frustum test be the first test.

Back-face culling discards objects that are facing away from the viewer,that is the normal vector of the object is directed away from theviewer. These objects will not be visible and there is hence no need todraw them.

Given a point, p(u,v) on a surface, back-face culling is in generalcomputed as:

c=p(u,v)·n(u,v)   equation (8)

where n(u,v) is the normal vector at (u,v). If c>0, then p(u,v) isback-facing for that particular value of (u,v). As such, this formulacan also be used to cull an entire triangle, which has only a singlenormal. The Taylor model of the dot product (see equations 5 and 8) iscomputed: {tilde over (c)}={tilde over (p)}(u,v)·n(u,v). To be able toback-face cull, the following must hold over the entire triangle domain:{tilde over (c)}>0. The lower bound on {tilde over (c)} isconservatively estimated again using the convex hull property of theBernstein form. This gives an interval, {tilde over (c)}=[c,c], and thetriangle (which has not been tessellated at this point) can be culled ifc>0.

In another embodiment interval bounds are computed for the normals. forchecking if the back-face condition is fulfilled.

The testing may also be performed using the positional bounds, {tildeover (p)}(u,v)=({tilde over (p)}_(x),{tilde over (p)}_(y),{tilde over(p)}_(z),{tilde over (p)}_(w)) or alternatively, the bounding volume.

Occlusion culling implies that objects that are occluded are discarded.In the following, occlusion culling is described for a bounding box butit is obvious to a person skilled in the art that it is possible toperform occlusion culling on other types of bounding volumes as well.

The occlusion culling technique is very similar to hierarchical depthbuffering, except that only a single extra level is used (8×8 pixeltiles) in the depth buffer. The maximum depth value, Z_(max) ^(title),is stored in each tile. This is a standard technique in GPUs used whenrasterizing triangles. The clip-space bounding box, b, is projected andall tiles overlapping this axis-aligned box are visited. At each tile,the classic occlusion culling test is performed: Z_(min) ^(box)≥Z_(max)^(tile), which indicates that the box is occluded at the current tile ifthe comparison is fulfilled. The minimum depth of the box, Z_(min)^(box), is obtained from the clip-space bounding box, and the maximumdepth of the tile, Z_(max) ^(tile), from the hierarchical depth buffer(which already exists in a contemporary GPU). Note that the testing canbe terminated as soon as a tile is found to be non-occluded, and that itis straightforward to add more levels to the hierarchical depth buffer.The occlusion culling test can be seen as a very inexpensivepre-rasterizer of the bounding box of the triangle to be tessellated.Since it operates on a tile basis, it is less expensive than anocclusion query.

In another embodiment, the testing may also be performed using thepositional bounds, {tilde over (p)}(u,v)=({tilde over (p)}_(x),{tildeover (p)}_(y),{tilde over (p)}_(z),{tilde over (p)}_(w)).

In one embodiment, the culling process is replaceable. This implies thatthe base primitive culling unit 212 may be supplied with a user-definedculling process.

Step 340 (and 350), executing a culling process, may have differentoutcomes. In one embodiment, an outcome of the culling process may bethat the base primitive is to be discarded. In another embodiment, anoutcome of the culling process may be that a tessellation factor iscreated. This tessellation factor may be set to a value indicating thatthe base primitive is to be discarded. Alternatively, the tessellationfactor may be set to a value indicating that the base primitive couldnot be discarded. Furthermore, the tessellation factor may be set to avalue indicating that the base primitive is not to be tessellated.

In one embodiment, after step 340 (and step 350) executing a cullingprocess, the outcome of the executing of a culling process is sent tothe tessellator 214. A tessellation process is executed, step 360 FIG. 3b. If the tessellator 214 receives a base primitive and a tessellationfactor indicating that the base primitive is not to be tessellated, thetessellator does not tessellate the base primitive.

If the tessellator 214 receives a base primitive that was not discardedin the culling process but does not receive a tessellation factorindicating that the base primitive is not to be tessellated, thetessellator 214 tessellates the base primitive.

The steps described in connection with FIGS. 3a and b may be performedin the apparatus 205.

FIG. 4 illustrates the results in the steps of FIGS. 3a and b. FIG. 4adepicts a base primitive in the form of a base triangle 405. FIG. 4bshows the resulting generated surface 410 over the base triangle 405which is determined by the vertex shader unit 216 (and the tessellationfrequency). In FIG. 4c the base triangle 405 is expressed in Taylor form(polynomial 415 and interval remainder 420, 425), thus obtaining aconservative estimate of the surface 410. In FIG. 4 d, The Taylorpolynomial is expanded in Bernstein form 430 for efficient rangebounding (using the convex hull property). In FIG. 4 e, the intervalremainder term 420, 425 is added from the Taylor model to the Bernsteinbounds 430, thus obtaining conservative surface bounds 445, 450.

FIG. 5 shows an overview architecture of a typical general purposecomputer 583 embodying the display adapter 205 of FIG. 2. The computer583 has a controller 570, such as a CPU, capable of executing softwareinstructions. The controller 570 is connected to a volatile memory 571,such as a random access memory (RAM) and a display adapter 500, thedisplay adapter corresponding to the display adapters 205 of FIG. 2. Thedisplay adapter 500 is in turn connected to a display 576, such as a CRTmonitor, an LCD monitor, etc. The controller 570 is also connected topersistent storage 573, such as a hard drive or flash memory and opticalstorage 574, such as reader and/or writer of optical media such as CD,DVD, HD-DVD or Blue-ray. A network interface 581 is also connected tothe controller 570 for providing access to a network 582, such as alocal area network, a wide area network (e.g. the Internet), a wirelesslocal area network or wireless metropolitan area network. Through aperipheral interface 577, e.g. interface of type universal serial bus,wireless universal serial bus, firewire, RS232 serial, Centronicsparallel, PS/2, the controller 570 can communicate with a mouse 578, akeyboard 579 or any other peripheral 580, including a joystick, aprinter, a scanner, etc.

It is to be noted that although a general purpose computer is describedabove to embody the invention, the invention can equally well beembodied in any environment where digital graphics, and in particular 3Dgraphics, is utilized, e.g. game consoles, mobile phones, MP3 players,etc.

The invention may furthermore be embodied in a much more general-purposearchitecture. The architecture may for example consists of many smallprocessor cores that can execute any type of program. This implies akind of a software GPU, in contrast to more hardware-centric GPU:s.

The invention has mainly been described above with reference to a fewembodiments. However, as is readily appreciated by a person skilled inthe art, other embodiments than the ones disclosed above are equallypossible within the scope of the invention, as defined by the appendedpatent claims.

We claim:
 1. A processor comprising: execution circuitry to executetessellation control instructions to determine a tessellation factor foreach primitive of a plurality of primitives in a graphics scene, theexecution circuitry to identify one or more back-facing primitives inthe plurality of primitives and to responsively set the tessellationfactor for each back-facing primitive to a first value to cause theback-facing primitive to be culled prior to tessellation; tessellationcircuitry to tessellate one or more of the primitives other than theback-facing primitives in accordance with the tessellation factorsdetermined by the tessellation control circuitry to generate tessellatedprimitives; and the execution circuitry to execute a fragment shader toperform shading operations on pixels generated from the tessellatedprimitives to generate shaded pixels.
 2. The processor of claim 1further comprising: rasterization circuitry to rasterize the shadedprimitives to generate the pixels.
 3. The processor of claim 2 wherein apixel is generated using a plurality of samples.
 4. The processor ofclaim 1 further comprising: depth testing circuitry to compare one ormore of the pixels with data in a depth buffer to identify visiblepixels and to discard invisible pixels.
 5. The processor of claim 1further comprising: blending circuitry to perform alpha blending on thepixels prior to display.
 6. The processor of claim 1 further comprising:the execution circuitry to execute instructions to associate one or moreof the tessellated primitives with a plurality of image tiles, each ofthe image tiles comprising a rectangle with a specified number ofcontiguous fragments, wherein each tessellated primitive is to beassociated with one or more of the image tiles which it overlaps.
 7. Theprocessor of claim 1 further comprising: the execution circuitry toexecute a vertex shader to process vertex coordinate data for verticesassociated with the tessellated primitives.
 8. A method comprising:executing tessellation control instructions to determine a tessellationfactor for each primitive of a plurality of primitives in a graphicsscene, identifying one or more back-facing primitives in the pluralityof primitives and to responsively set the tessellation factor for eachback-facing primitive to a first value to cause the back-facingprimitive to be culled prior to tessellation; tessellating one or moreof the primitives other than the back-facing primitives in accordancewith the tessellation factors to generate tessellated primitives; andexecuting a fragment shader to perform shading operations on pixelsgenerated from the tessellated primitives to generate shaded pixels. 9.The method of claim 8 further comprising: rasterizing the shadedprimitives to generate the pixels.
 10. The method of claim 9 wherein apixel is generated using a plurality of samples.
 11. The method of claim8 further comprising: comparing one or more of the pixels with data in adepth buffer to identify visible pixels and to discard invisible pixels.12. The method of claim 8 further comprising: performing alpha blendingon the pixels prior to display.
 13. The method of claim 8 furthercomprising: executing instructions to associate one or more of thetessellated primitives with a plurality of image tiles, each of theimage tiles comprising a rectangle with a specified number of contiguousfragments, wherein each tessellated primitive is to be associated withone or more of the image tiles which it overlaps.
 14. The method ofclaim 8 further comprising: executing a vertex shader to process vertexcoordinate data for vertices associated with the tessellated primitives.15. A machine-readable medium having program code stored thereon which,when executed by a machine, causes the machine to perform the operationsof: executing tessellation control instructions to determine atessellation factor for each primitive of a plurality of primitives in agraphics scene, identifying one or more back-facing primitives in theplurality of primitives and to responsively set the tessellation factorfor each back-facing primitive to a first value to cause the back-facingprimitive to be culled prior to tessellation; tessellating one or moreof the primitives other than the back-facing primitives in accordancewith the tessellation factors to generate tessellated primitives; andexecuting a fragment shader to perform shading operations on pixelsgenerated from the tessellated primitives to generate shaded pixels. 16.The machine-readable medium of claim 15 further comprising program codeto cause the machine to perform the operations of: rasterizing theshaded primitives to generate the pixels.
 17. The machine-readablemedium of claim 16 wherein a pixel is generated using a plurality ofsamples.
 18. The machine-readable medium of claim 15 program code tocause the machine to perform the operations of: comparing one or more ofthe pixels with data in a depth buffer to identify visible pixels and todiscard invisible pixels.
 19. The machine-readable medium of claim 15program code to cause the machine to perform the operations of:performing alpha blending on the pixels prior to display.
 20. Themachine-readable medium of claim 15 program code to cause the machine toperform the operations of: executing instructions to associate one ormore of the tessellated primitives with a plurality of image tiles, eachof the image tiles comprising a rectangle with a specified number ofcontiguous fragments, wherein each tessellated primitive is to beassociated with one or more of the image tiles which it overlaps. 21.The machine-readable medium of claim 15 program code to cause themachine to perform the operations of: executing a vertex shader toprocess vertex coordinate data for vertices associated with thetessellated primitives.